
<div id="main-content"> <!-- Main Content Section with everything -->			
	<!-- Page Head -->						
	<div class="clear"></div> <!-- End .clear -->
	
	<div class="content-box"><!-- Start Content Box -->
		
		<div class="content-box-header">
			
			<h3><?php echo $query?'修改':'新建'?>员工项</h3>					
			<div class="clear"></div>
			
		</div> <!-- End .content-box-header -->
		
		<div class="content-box-content">
			
			<div >
			
				<form action="<?php echo base_url()?>staff/execute" method="post">
						<input type='hidden' name='id' value='<?php echo $query?$query['id']:''?>'>						
						<p>
							<label>员工姓名：</label>
								<input class="text-input small-input" type="text" id="small-input" name="name" value='<?php echo $query?$query['name']:''?>' /> 
								
						</p>
						<p>
							<label>部门：</label>
							<select name="department">
							<?php foreach(department_options() as $k=>$v):?>
								<option value='<?php echo $k?>' <?php echo ($query&&$query['department']==$k)?'selected':''?>><?php echo $v?></option>
							<?php endforeach;?>
							</select>
						</p>
						<p>
							<label>职务：</label>
								<input class="text-input small-input" type="text" id="small-input" name="job" value='<?php echo $query?$query['job']:''?>' /> 										
						</p>
						<p>
							<label>分机：</label>
								<input class="text-input small-input" type="text" id="small-input" name="extension" value='<?php echo $query?$query['extension']:''?>' /> 										
						</p>
						<p>
							<label>手机：</label>
								<input class="text-input small-input" type="text" id="small-input" name="mobile" value='<?php echo $query?$query['mobile']:''?>' /> 										
						</p>
						<p>
							<label>Email：</label>
								<input class="text-input small-input" type="text" id="small-input" name="email" value='<?php echo $query?$query['email']:''?>' /> 										
						</p>
						<?php if ($query): ?>
						<input type="radio" name="status" value="1" <?php echo $query['status']==1?'checked':''?> />在职 &nbsp
						<input type="radio" name="status" value="2" <?php echo $query['status']==2?'checked':''?> />离职
							<?php if($list = staff_goods_list($query['id'])):?>
								
									<table style="width:50%;">
										<thead>
											<tr>
												<th>主机：</th>
												<th>&nbsp </th>
												<th>&nbsp </th>
												<th>&nbsp </th>
											</tr>
										<thead>
										<tbody>
											<?php $i=0;foreach($list as $row):$i++;?>
											<?php if($row['categoryid'] == '1'):?>
											<tr>
												<td><?php echo $row['name'];?></td>
												<td><?php echo $row['brand'];?></td>
												<td><?php echo $row['condition'];?></td>
												<td>
													<div class="button unstall">
													卸载入库
													<input type="hidden" value="5_<?php echo $row['id']?>">
													</div>
													<div class="button unstall">
													卸载报废
													<input type="hidden" value="6_<?php echo $row['id']?>">
													</div>
												</td>
											</tr>
											<?php endif;?>
											<?php endforeach?>
											<input type="hidden" value='<?php echo $i;?>' name="hostcount">
										</tbody>
									</table>
									
									<table style="width:50%;">
										<thead>
											<tr>
												<th>外设：</th>
												<th>&nbsp </th>
												<th>&nbsp </th>
												<th>&nbsp </th>
											</tr>
										<thead>
										<tbody>
											<?php $i=0;foreach($list as $row):$i++;?>
											<?php if($row['categoryid'] == '2'):?>
											<tr>
												<td><?php echo $row['name'];?></td>
												<td><?php echo $row['brand'];?></td>
												<td><?php echo $row['condition'];?></td>
												<td>
													<div class="button unstall">
													卸载入库
													<input type="hidden" value="5_<?php echo $row['id']?>">
													</div>
													<div class="button unstall">
													卸载报废
													<input type="hidden" value="6_<?php echo $row['id']?>">
													</div>
												</td>
											</tr>
											<?php endif;?>
											<?php endforeach?>
											<input type="hidden" value='<?php echo $i;?>' name="hostcount">
										</tbody>
									</table>
									
									<table style="width:50%;">
										<thead>
											<tr>
												<th>参考书：</th>
												<th>&nbsp </th>
												<th>&nbsp </th>
												<th>&nbsp </th>
											</tr>
										<thead>
										<tbody>
											<?php $i=0;foreach($list as $row):$i++;?>
											<?php if($row['categoryid'] == '3'):?>
											<tr>
												<td><?php echo $row['name'];?></td>
												<td><?php echo $row['brand'];?></td>
												<td><?php echo $row['condition'];?></td>
												<td>
													<div class="button unstall">
													卸载入库
													<input type="hidden" value="5_<?php echo $row['id']?>">
													</div>
													<div class="button unstall">
													卸载报废
													<input type="hidden" value="6_<?php echo $row['id']?>">
													</div>
												</td>
											</tr>
											<?php endif;?>
											<?php endforeach?>
											<input type="hidden" value='<?php echo $i;?>' name="hostcount">
										</tbody>
									</table>
									
									<table style="width:50%;">
										<thead>
											<tr>
												<th>耗材：</th>
												<th>&nbsp </th>
												<th>&nbsp </th>
												<th>&nbsp </th>
											</tr>
										<thead>
										<tbody>
											<?php $i=0;foreach($list as $row):$i++;?>
											<?php if($row['categoryid'] == '4'):?>
											<tr>
												<td><?php echo $row['name'];?></td>
												<td><?php echo $row['brand'];?></td>
												<td><?php echo $row['condition'];?></td>
												<td>
													<div class="button unstall">
													卸载入库
													<input type="hidden" value="5_<?php echo $row['id']?>">
													</div>
													<div class="button unstall">
													卸载报废
													<input type="hidden" value="6_<?php echo $row['id']?>">
													</div>
												</td>
											</tr>
											<?php endif;?>
											<?php endforeach?>
											<input type="hidden" value='<?php echo $i;?>' name="hostcount">
										</tbody>
									</table>
							<?php endif;?>
						<?php endif;?>
						<p>
							<input class="button" type="submit" value="Submit" />
							<input class="button back" type="button" value="Back" />
						</p>
					<div class="clear"></div><!-- End .clear -->
				</form>						
			</div>					
		</div> <!-- End .content-box-content -->
		
	</div> <!-- End .content-box -->
	<div class="clear"></div>			
</div> <!-- End #main-content -->	
<script>
	$(function() {
		$(".unstall").click(function(){
			$(this).parents("tr").addClass("del");
			$.post("<?php echo base_url();?>staff/ajax",{data:$(this).children().val()},function(result){
				$(".del").remove();
			});
		});
	});
</script>